<cfcomponent>
  <cfset _i = structNew() />
  <cfset _i.gatewayComponent = "" />
  <cfset _i.findMethodName= "" />
  <cfset _i.findArguments= "" />
  <cffunction name="init" output="false">
    <cfargument name="gatewayComponent" required="true"  />
    <cfargument name="findMethodName" required="true" type="string" />
    <cfargument name="sizeMethodName" required="true" type="string" />
    <cfargument name="findArguments" required="true" type="struct" />
    <cfset setGatewayComponent(arguments.gatewayComponent) >
    <cfset setFindMethodName(arguments.findMethodName) >
    <cfset setSizeMethodName(arguments.sizeMethodName) >
    <cfset setFindArguments(arguments.findArguments) >
  </cffunction>


  <cffunction name="load" output="false" returnType="array">
    <cfset var res = "" />
    <cfset res = evaluate("getGatewayComponent().#getFindMethodName()#(argumentcollection=getFindArguments())") />
    <cfreturn res />
  </cffunction>

  <cffunction name="findByProperty" output="false" returnType="array">
    <cfargument name="name" type="string" required="true">
    <cfargument name="value" type="string" required="true">
    <cfset var res = "" />
    <cfset res = evaluate("getGatewayComponent().findBy#arguments.name#(value='#arguments.value#')") />
    <cfreturn res />
  </cffunction>

  <cffunction name="size" output="false" returnType="numeric">
    <cfset var res = "" />
    <cfset res = evaluate("getGatewayComponent().#getSizeMethodName()#(argumentcollection=getFindArguments())") />
    <cfreturn res />
  </cffunction>


  <cffunction name="setGatewayComponent" >
    <cfargument name="value" required="true" />
    <cfset _i.gatewayComponent= arguments.value/>
  </cffunction>

  <cffunction name="setFindMethodName" >
    <cfargument name="value" required="true" type="string" />
    <cfset _i.findMethodName = arguments.value />
  </cffunction>

  <cffunction name="setSizeMethodName" >
    <cfargument name="value" required="true" type="string" />
    <cfset _i.sizeMethodName = arguments.value/>
  </cffunction>

  <cffunction name="setFindArguments" >
    <cfargument name="value" required="true" type="struct" />
    <cfset _i.findArguments= arguments.value />
  </cffunction>

  <cffunction name="getGatewayComponent" >
    <cfreturn _i.gatewayComponent/>
  </cffunction>

  <cffunction name="getFindMethodName" >
    <cfreturn _i.findMethodName />
  </cffunction>

  <cffunction name="getSizeMethodName" >
    <cfreturn _i.sizeMethodName />
  </cffunction>

  <cffunction name="getFindArguments" >
    <cfreturn _i.findArguments />
  </cffunction>
</cfcomponent>